package com.tensai.study.java.newconcept.typefunctionprogram.base.java_util_function.consumer;

import org.junit.Test;

import java.util.function.Consumer;

/**
 * 定义消费
 *
 * @author Tensai
 */
public class ConsumerTest {

	/**
	 * accept 接收参数
	 * andThen 构建消费链 链接后续消费逻辑
	 */
	@Test
	public void test() {
		Consumer<Integer> consumer = (x) -> {
			int num = x * 2;
			System.out.println(num);
		};
		Consumer<Integer> consumer1 = (x) -> {
			int num = x * 3;
			System.out.println(num);
		};
		consumer.andThen(consumer1).accept(10);
	}
}